$(function () {
    const outlineDemoApi = api.outlineDemo;

    layui.config({
        base: '/layui/lay/modules/'
    }).extend({
        treetable: 'treetable-lay/treetable'
    }).use(['treetable','table', 'layer', 'form', 'laypage', 'laydate'], function () {
        var table = layui.table //表格
            , layer = layui.layer //弹层
            , form = layui.form //form表单
            , laypage = layui.laypage //分页
            , laydate = layui.laydate//日期
            ,treetable = layui.treetable;

        var renderTable = function (data) {
            // layer.load(2);
            treetable.render({
                treeColIndex: 0,          // treetable新增参数
                treeSpid: -1,             // treetable新增参数
                treeIdName: 'd_id',       // treetable新增参数
                treePidName: 'd_pid',     // treetable新增参数
                treeDefaultClose: true,   // treetable新增参数
                treeLinkage: true,        // treetable新增参数
                elem: '#table1',
                data: data,
                cols: [[
                    // {type: 'number'},
                    // {field: 'id', title: 'id'},
                    {field: 'num', title: '标号', width: 150},
                    {field: 'name', title: '名称', width: 225},
                    {field: 'intro', title: '介绍', width: 350},
                ]]
            });
        };
        var getOutline = async () => {
            const res = await outlineDemoApi();
            renderTable(res.data.content);
        }
        getOutline();
    });

})